import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import router from './router'
import pinia from './stores'
import App from './App.vue'
import './style.css'
import './assets/css/variables.css'

import { ElMessage } from 'element-plus'
import './assets/styles/message.css'

// 配置全局的ElementPlus选项
const app = createApp(App)

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 直接设置ElMessage全局默认选项
ElMessage.defaults = {
    showClose: true,
    duration: 7000
};

// 使用插件
app.use(ElementPlus, {
    locale: zhCn,
    config: {
        // 消息配置
        message: {
            duration: 7000,
            showClose: true
        }
    }
})
app.use(router)
app.use(pinia)

app.mount('#app')
